#!/bin/bash

path=`pwd`
config=$path/config
bin=$path/bin
python_config=$config/python
python=$bin/python

echo "准备清理旧文件"
source $python/uninstall.sh

echo "开始安装解压python源码（为保证环境一致，压缩包用我的）"
wget https://registry.npmmirror.com/-/binary/python/3.10.11/Python-3.10.11.tgz
tar -xzf Python-3.10.11.tgz
cd $path/Python-3.10.11

echo "配置编译环境"
./configure --with-ssl --with-pydebug --enable-shared --prefix=$path/python

echo "开始编译"
make

echo "安装python"
make install
cd $path
rm -rf $path/Python-3.10.11
rm -rf Python-3.10.11.tgz

echo "配置环境变量"
echo 'export PATH="'$path'/python/bin:''$PATH"' > $python_config/export.txt
echo 'export LD_LIBRARY_PATH="'$path'/python/lib:$LD_LIBRARY_PATH"' >> $python_config/export.txt
source $bin/export.sh $python_config/export.txt

echo "在设置好的环境变量里进行软连接"
cd $path/python/bin
ln -s python3.10 python
ln -s pip3 pip
cd $path

echo "开始安装python安装插件所需工具"
source $python/rely.sh









